﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B.W.traceability.Infrastructure
{
    public class BInfrastructure<T> : IBInfrastructure<T> where T : class
    {
        public BInfrastructure(SCDbcontext db)
        {
            Db = db;
        }

        public SCDbcontext Db { get; }

        public int Add(T t)
        {
            Db.Set<T>().Add(t);
            return Db.SaveChanges();


        }

        public IQueryable<T> Query()
        {
            return Db.Set<T>().AsQueryable();
        }

        public int Uppdate(T t)
        {
            Db.Set<T>().Update(t);
            return Db.SaveChanges();
        }
    }
}
